package com.inlycat.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.validation.constraints.Past;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Length;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author jarvan4dev@163.com
 * @since 2015年8月12日下午1:12:52
 * @category 用户实体类
 */

//json转换的时候，用于过滤null字段
//@JsonInclude(Include.NON_NULL)
public class User implements Serializable {

	private static final long serialVersionUID = -8740745828924615926L;

	private Long id;

	/**
	 * 手机号
	 */
	@Pattern(regexp = "^1[3|4|5|7|8][0-9]{9}$", message = "{user.username.pattern}")
	private String username;

	@Length(min = 8, max = 16, message = "{user.password.length}")
	private String password;
	private String qq;
	private String wechat;
	private String weibo;

	@Past(message = "{user.lastAccessTime.past}")
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")//格式化日期
	private Date lastAccessTime;

	@Pattern(regexp = "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$", message = "{user.lastAccessIP.pattern}")
	private String lastAccessIP;

	@Past(message = "{user.registerTime.past}")
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")//格式化日期
	private Date registerTime;

	/**
	 * 用户状态
	 */
	private Integer status;

	/**
	 * 用户信息
	 */
	private UserInfo userInfo;

	/**
	 * 账户信息
	 */
	private Account account;

	/**
	 * 用户收藏
	 */
	private List<Store> stores;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getQq() {
		return qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}

	public String getWechat() {
		return wechat;
	}

	public void setWechat(String wechat) {
		this.wechat = wechat;
	}

	public String getWeibo() {
		return weibo;
	}

	public void setWeibo(String weibo) {
		this.weibo = weibo;
	}

	public Date getLastAccessTime() {
		return lastAccessTime;
	}

	public void setLastAccessTime(Date lastAccessTime) {
		this.lastAccessTime = lastAccessTime;
	}

	public String getLastAccessIP() {
		return lastAccessIP;
	}

	public void setLastAccessIP(String lastAccessIP) {
		this.lastAccessIP = lastAccessIP;
	}

	public Date getRegisterTime() {
		return registerTime;
	}

	public void setRegisterTime(Date registerTime) {
		this.registerTime = registerTime;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public UserInfo getUserInfo() {
		return userInfo;
	}

	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}

	public Account getAccount() {
		return account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	public List<Store> getStores() {
		return stores;
	}

	public void setStores(List<Store> stores) {
		this.stores = stores;
	}

	@Override
	public String toString() {
		return "User [id=" + id + ", username=" + username + ", password="
				+ password + ", qq=" + qq + ", wechat=" + wechat + ", weibo="
				+ weibo + ", lastAccessTime=" + lastAccessTime
				+ ", lastAccessIP=" + lastAccessIP + ", registerTime="
				+ registerTime + ", status=" + status + ", userInfo="
				+ userInfo + ", account=" + account + ", stores=" + stores
				+ "]";
	}

}
